/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import com.opensymphony.xwork2.ActionContext;
import entity.Administrator;
import java.util.Map;
import model.bll.LoginBL;

/**
 *
 * @author Hailk_c00639
 */
public class LoginAdminAction {
    private LoginBL loginBL = new LoginBL();
    private Administrator admin;
     
    public LoginAdminAction() {
    }
    public Administrator getLogin() {
        if (admin == null) {
            admin = new Administrator();
        }
        return admin;
    }
    public void setLogin(Administrator admin) {
        this.admin = admin;
    }
    
    
    
    public String execute() throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    public String login() {
        if (loginBL.customerLogin(admin.getAdminName(), admin.getPassword())) {
            Map session = ActionContext.getContext().getSession();
            //session.put("anzUser", loginBL.customerLogin(admin.getAdminID()));
            session.put("anzUser", loginBL.customerLogin(admin.getAdminName(), admin.getPassword()));
            return "success";
        }
        return "fail";
    }
}